import { Button, Card, Table } from "antd";
import React from "react";

const columns = [
  {
    title: "序号",
    key: "id",
    width: 80,
    align: "center",
    render: (txt, record, index) => index + 1,
  },
  {
    title: "标题",
    dataIndex: "title",
    align: "center",
  },
  {
    title: "内容概览",
    dataIndex: "overview",
    align: "center",
  },
  {
    title: "更新日期",
    dataIndex: "updateDate",
    align: "center",
  },
];
const dataSource = [
  {
    title: "测试新闻",
    overview: "这是一条用来测试的...",
    updateDate:"2021-8-3"
  },
];
function News() {
  return (
    <Card
      title="最新公告"
      type="inner"
      bordered={true}
      style={{width:"100%"}}
      extra={<Button type="primary">刷新</Button>}
    >
      <Table
        rowKey="title"
        columns={columns}
        dataSource={dataSource}
        bordered={true}
        pagination={{ total: dataSource.length, pageSize: 2 }}
        onRow={(txt, record) => {
          return {
            onClick: (event) => {
              console.log(record);
            },
          };
        }}
      />
    </Card>
  );
}

export default News;
